package com.wsw.ssh.system.model;

// default package

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * roleMenu entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_role_menu")
@DynamicInsert(true)
@DynamicUpdate(true)
public class RoleMenu implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private RoleMenuId id;
	private Menu menu;
	private Role role;

	// Constructors

	/** default constructor */
	public RoleMenu() {
	}

	/** full constructor */
	public RoleMenu(RoleMenuId id, Menu menu, Role role) {
		this.id = id;
		this.menu = menu;
		this.role = role;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "menuId", column = @Column(name = "t_menu_id", nullable = false, length = 32)),
			@AttributeOverride(name = "roleId", column = @Column(name = "t_role_id", nullable = false, length = 32)) })
	public RoleMenuId getId() {
		return this.id;
	}

	public void setId(RoleMenuId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "t_menu_id", nullable = false, insertable = false, updatable = false)
	public Menu getmenu() {
		return this.menu;
	}

	public void setmenu(Menu menu) {
		this.menu = menu;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "t_role_id", nullable = false, insertable = false, updatable = false)
	public Role getrole() {
		return this.role;
	}

	public void setrole(Role role) {
		this.role = role;
	}

}